/**
 * Created by Administrator on 2017/3/2 0002.
 */
var Page0={
    create:function () {
    var bool_touch=true;
        var page={};
        page.ui=new PIXI.DisplayObjectContainer();
        page.ui.interactive=true;

        var bg1=Easy.CreateSprite('assets/images/bg.png',0,0,0.0,0.0,1);
        bg1.interactive=true;
        page.ui.addChild(bg1);
        var bg2=Easy.CreateSprite('assets/images/bg2.png',0,0,0.0,0.0,1);
        // var bg3=Easy.CreateSprite('assets/images/bg3.png',0,0,0.0,0.0,0);

        var md = document.getElementById('mVideo');
        md.addEventListener("ended",function(){
            page.ui.removeChild(bg1);
            page.ui.addChild(bg2);
            bg2.interactive=true;
            document.getElementById('div_2d').style.zIndex=5;
        });

        bg1.on('pointerdown',function (e) {
            bg1.interactive=false;

            setTimeout(function () {
                page.ui.addChild(bg2);
            },500);

            document.getElementById('div_video').style.zIndex=5;
            document.getElementById('mVideo').currentTime=0;
            document.getElementById('mVideo').play();
            document.getElementById('mVideo').style.width=740*pixiStage.scale.x+'px';
            document.getElementById('mVideo').style.height=1136*pixiStage.scale.y+'px';
            document.getElementById('mVideo').style.position='absolute';
            document.getElementById('mVideo').style.left= pixiStage.scale.x*0+pixiStage.x+'px';
            document.getElementById('mVideo').style.top= pixiStage.scale.y*0+pixiStage.y+'px';
        });
        bg2.on('pointerdown',function (e) {
            bg2.interactive = false;

            window.addEventListener('mousedown',function () {
                if(bool_touch)
                {
                    document.getElementById('mVideo1').play();
                }
            });
            window.addEventListener('touchstart',function () {
                if(bool_touch)
                {
                    document.getElementById('mVideo1').play();
                }
            });
            window.addEventListener('mouseup',function () {
                if(bool_touch)
                {
                    document.getElementById('mVideo1').pause();
                }
            });
            window.addEventListener('touchend',function () {
                if(bool_touch)
                {
                    document.getElementById('mVideo1').pause();
                }
            });
            document.getElementById('div_video1').style.zIndex=6;
            document.getElementById('mVideo1').pause();
            document.getElementById('mVideo1').style.width=740*pixiStage.scale.x+'px';
            document.getElementById('mVideo1').style.height=1136*pixiStage.scale.y+'px';
            document.getElementById('mVideo1').style.position='absolute';
            document.getElementById('mVideo1').style.left= pixiStage.scale.x*0+pixiStage.x+'px';
            document.getElementById('mVideo1').style.top= pixiStage.scale.y*0+pixiStage.y+'px';


            var md1 = document.getElementById('mVideo1');
            md1.addEventListener("ended",function(){
                bool_touch=false;
                // page.ui.addChild(bg3);
                // TweenMax.to(bg3,0.1,{alpha:1});
                // document.getElementById('div_2d').style.zIndex=99;

            });
        });




        page.In=function () {

        }
        page.Out=function () {

        }

       
         return page;
    }
}